package com.bokesoft.project;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
//@Import({DataCopyConfig.class,DataCopyUtil.class})
@ComponentScan(basePackages= {"com.bokesoft.project.ext.mid"})
public class ServletContextBean implements ApplicationContextAware {
	private static ApplicationContext applicationContext;
	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		ServletContextBean.applicationContext = applicationContext;
	}

	public static <T> T getBean(Class<T> clazz) {
		return applicationContext.getBean(clazz);
	}
	public static Object getBean(Class<?> clazz,String beanName) {
		return applicationContext.getBean(beanName, clazz);
	}
}
